//alert("hello");
console.log('你好世界');


var a = 10;
console.log(a);

let b = 15;
console.log(b);

let  c = '15'
console.log(b == c);


let d = 1;
let e = true;
console.log(d == e);


console.log(b === c);

let arr = new Array();

let arr2 = [];

let arr3 = [78,56,522,110,200];

let arr4 = [78,'hello',true,[]];

let arr5 = ['Lucy','Luck','pee'];
console.log(arr5[2]);
console.log(arr5);

arr5[2] = 'fff';
console.log(arr5[2]);
console.log(arr5[400]);

console.log(arr5[-1]);

arr5[100] = '哈哈哈哈';
console.log(arr5);

arr5[-1] = 'kukuku';
arr5['llll'] = 'lilili';
console.log(arr5);

console.log("-----------------------")
for (let i = 0;i<arr5.length;i++){
    console.log(arr5[i]);
}

console.log("-----------------------")

for (let i in arr5){
    console.log(arr5[i]);

}
console.log("-----------------------")

for(let elem of arr5){
    console.log(elem);
}

arr5.push('gegege');

console.log("-----------------------")


for(let elem of arr5){
    console.log(elem);
}

arr5.splice(2,1,);

console.log(arr5);

arr5.splice(2,1,'jjjj');

console.log(arr5);


function f1(){
    console.log('fffff');
}

f1();

function add(x,y){
    //每个函数里面都会自动定义一个 arguments 变量,是个数组,包含了所有实参
    return x+y;
}

console.log(add(20,78));
console.log(add('hhh','5555'));
console.log(add(1,true));
console.log(add(undefined,55));
console.log(add(undefined,'55'));

function  add2(){
    let result = 0;
    for (let elem of arguments) {
        result+=elem;
    }
    return result;
}

console.log(add2(10));
console.log(add2(10,20));
console.log(add2(10,20,30));
console.log(add2(10,50,20,30,50));


let add3 = function (){
    let result = 0;
    for (let elem of arguments) {
        result+=elem;
    }
    return result;
}

console.log(typeof(add3));


let student = {
    name : '扣扣',
    age : 25,
    height : 180,
    weight : 140,
    sing : function (){
        console.log('唱歌');
    },
    dance :function (){
        console.log('跳舞');
    }
};

console.log(student.name);
console.log(student.height);
student.sing();



let s = new Object();
s.name = '可可';
s.sing = function (){
    console.log('呼啦啦');
}
console.log(s.name);
console.log(s.sing());

